#include "creatsquaredialog.h"
#include "ui_creatsquaredialog.h"

CreatSquareDialog::CreatSquareDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CreatSquareDialog)
{
    ui->setupUi(this);
    setWindowTitle(tr("Create a square"));
    connect(ui->okButton,SIGNAL(clicked()),this,SLOT(dataCreatSquareAccept()));
    connect(ui->okButton,SIGNAL(clicked()),this,SLOT(close()));
    connect(ui->cancelButton,SIGNAL(clicked()),this,SLOT(close()));
}
void CreatSquareDialog::dataCreatSquareAccept()
{
    int xValue=ui->xValueSpinBox->value();
    int yValue=ui->yValueSpinBox->value();
    int sideLengthValue=ui->sideLengthSpinBox->value();
    emit sendCreatSquare(xValue,yValue,sideLengthValue);
}
void CreatSquareDialog::receiveSquareRange(int x_Value_Max, int y_Value_Max)
{
    xValueMax=x_Value_Max;
    yValueMax=y_Value_Max;
    ui->xValueSpinBox->setRange(0,xValueMax);
    ui->yValueSpinBox->setRange(0,yValueMax);
}
CreatSquareDialog::~CreatSquareDialog()
{
    delete ui;
}
